"""
找美图判断大小，移动到指定文件夹\
未完待续“移动失败”
"""
import os
from PIL import Image

# input("输入要寻找的图片的文件夹：（）")
Dir_windows = r'C:\Users\LCQ\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets'
Dir_move = r"C:\Users\LCQ\OneDrive\图片\本机照片\Windows聚焦"
file_class = os.walk(Dir_windows)


def choose_size(size=(1920, 1080)):
    global n
    if Image.open(path).size == size:
        if len(file) >= 20:
            name = path[-5:]
            os.system(f"move {path} {Dir_move}\\size{size}\\{name}.jpg")
            print(f"成功移动了图片{path[-5:]}.jpg")
            n = n + 1


for root, dirs, files in file_class:
    for file in files:
        path = os.path.join(root, file)
        print(len(file))
        n = 0
        choose_size((1080, 1920))
        choose_size()

print(f"从目录“{Dir_windows}”下，\n一共找到了“{n}”张分辨率为（1920*1080）的图片到目录:“{Dir_move}”")
